n = int(input())

s = input()
stack = []
for c in s:
    if len(stack)==0:
        stack.append(c)
        continue
    if c == stack[-1]:
        stack.append(c)
    else:
        stack.pop()
print(len(stack))